#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>
#define MaxSize 100

typedef int ElemType;
typedef struct Stack{
    ElemType data[MaxSize];
    int top;
}SqStack;

void initStack(SqStack *S);
bool push(SqStack *S, ElemType elem);
bool pop(SqStack *S, ElemType *elem);

int main(){
    SqStack S;
    initStack(&S);
    push(&S, 100);
    printf("%d, %d\n", S.data[S.top], S.top);
    int elem = 0;
    pop(&S, &elem);
    printf("%d,\n", S.top, elem);
    return 0;
}

void initStack(SqStack *S){
    S->top = -1;
}

bool push(SqStack *S, ElemType elem){
    if(S->top==MaxSize-1) return false;
    S->top+=1;
    S->data[S->top] = elem;
    return true;
}

bool pop(SqStack *S, ElemType *elem){
    if(S->top==-1) return false;
    *elem = S->data[S->top--];
    return true;
}